for i in 1 ... 3 {
    while !isBlocked {
        moveForward()
        
        if isOnClosedSwitch {
            toggleSwitch()
            
        }
        
        if isOnGem {
            collectGem()
            
        }
        
    }
    
    if isBlocked && isBlockedLeft {
        
        turnRight()
        moveForward()
        turnRight()
        
    } else if isBlocked && !isBlockedLeft {
        turnLeft()
        moveForward()
        turnLeft()
        
    }
    
}
